package simulateOS;

import javafx.application.Application;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
import simulateOS.UI.MainUI;

/**
 * Description：启动类
 * Date: 2022/10/25
 * Time: 20:33
 *
 * @Author SillyBaka
 **/
@SpringBootApplication
public class MainApplication extends Application {

    public static ConfigurableApplicationContext applicationContext;

    private static String[] args;

    public static void main(String[] args) {
        MainApplication.args = args;
        launch(args);
    }

    @Override
    public void init() throws Exception {
        applicationContext = SpringApplication.run(MainApplication.class, args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        // todo 这里执行javaFX启动逻辑
        primaryStage = MainUI.getMainUI().getStage();

        primaryStage.show();
    }

    @Override
    public void stop() throws Exception {
        applicationContext.stop();
    }
}
